home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ainet / panel.frm < prev    next >
Text File  |  1997-07-22  |  23KB  |  651 lines

  1. VERSION 4.00
  2. Begin VB.Form MainForm 
  3.    Caption         =   "Test PANEL for Testing aiNet Functions"
  4.    ClientHeight    =   7068
  5.    ClientLeft      =   924
  6.    ClientTop       =   3372
  7.    ClientWidth     =   8160
  8.    Height          =   7452
  9.    Icon            =   "Panel.frx":0000
  10.    Left            =   876
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   7068
  13.    ScaleWidth      =   8160
  14.    Top             =   3036
  15.    Width           =   8256
  16.    Begin VB.CommandButton InfoBtn 
  17.       BackColor       =   &H000000FF&
  18.       Caption         =   "Info"
  19.       Height          =   372
  20.       Left            =   6840
  21.       TabIndex        =   13
  22.       Top             =   2040
  23.       Width           =   1092
  24.    End
  25.    Begin VB.CommandButton SaveBtn 
  26.       Caption         =   "Save Model"
  27.       Height          =   372
  28.       Left            =   5520
  29.       TabIndex        =   12
  30.       Top             =   1560
  31.       Width           =   1212
  32.    End
  33.    Begin VB.CommandButton GenerateBtn 
  34.       Caption         =   "Generate MV"
  35.       Height          =   372
  36.       Left            =   5520
  37.       TabIndex        =   11
  38.       Top             =   2040
  39.       Width           =   1212
  40.    End
  41.    Begin VB.CommandButton SettingsBtn 
  42.       Caption         =   "Settings"
  43.       Height          =   372
  44.       Left            =   4200
  45.       TabIndex        =   10
  46.       Top             =   2040
  47.       Width           =   1212
  48.    End
  49.    Begin VB.CommandButton ExcludeBtn 
  50.       Caption         =   "Exclude MV"
  51.       Height          =   372
  52.       Left            =   2880
  53.       TabIndex        =   9
  54.       Top             =   2040
  55.       Width           =   1212
  56.    End
  57.    Begin VB.CommandButton NewMVBtn 
  58.       Caption         =   "New MV"
  59.       Height          =   372
  60.       Left            =   1560
  61.       TabIndex        =   8
  62.       Top             =   2040
  63.       Width           =   1212
  64.    End
  65.    Begin VB.CommandButton ShowModelBtn 
  66.       Caption         =   "Show Model"
  67.       Height          =   372
  68.       Left            =   240
  69.       TabIndex        =   7
  70.       Top             =   2040
  71.       Width           =   1212
  72.    End
  73.    Begin VB.CommandButton ExitBtn 
  74.       BackColor       =   &H00C0C0C0&
  75.       Caption         =   "Exit"
  76.       Height          =   372
  77.       Left            =   6840
  78.       TabIndex        =   6
  79.       Top             =   1560
  80.       Width           =   1092
  81.    End
  82.    Begin VB.CommandButton NewCapacityBtn 
  83.       Caption         =   "New Capacity"
  84.       Height          =   372
  85.       Left            =   4200
  86.       TabIndex        =   5
  87.       Top             =   1560
  88.       Width           =   1212
  89.    End
  90.    Begin VB.CommandButton PredictBtn 
  91.       Caption         =   "Prediction"
  92.       Height          =   372
  93.       Left            =   2880
  94.       TabIndex        =   4
  95.       Top             =   1560
  96.       Width           =   1212
  97.    End
  98.    Begin VB.CommandButton PredictionBtn 
  99.       Caption         =   "Load Sample"
  100.       Height          =   372
  101.       Left            =   1560
  102.       TabIndex        =   3
  103.       Top             =   1560
  104.       Width           =   1212
  105.    End
  106.    Begin VB.CommandButton StatusBtn 
  107.       Caption         =   "Status Report"
  108.       Height          =   372
  109.       Left            =   240
  110.       TabIndex        =   2
  111.       Top             =   1560
  112.       Width           =   1212
  113.    End
  114.    Begin VB.TextBox tOut 
  115.       BeginProperty Font 
  116.          name            =   "Courier New"
  117.          charset         =   1
  118.          weight          =   400
  119.          size            =   10.2
  120.          underline       =   0   'False
  121.          italic          =   0   'False
  122.          strikethrough   =   0   'False
  123.       EndProperty
  124.       Height          =   4332
  125.       Left            =   240
  126.       MultiLine       =   -1  'True
  127.       ScrollBars      =   2  'Vertical
  128.       TabIndex        =   1
  129.       Top             =   2520
  130.       Width           =   7692
  131.    End
  132.    Begin VB.PictureBox Picture1 
  133.       BorderStyle     =   0  'None
  134.       Height          =   1452
  135.       Left            =   240
  136.       Picture         =   "Panel.frx":0442
  137.       ScaleHeight     =   1452
  138.       ScaleWidth      =   7692
  139.       TabIndex        =   0
  140.       Top             =   120
  141.       Width           =   7692
  142.    End
  143. End
  144. Attribute VB_Name = "MainForm"
  145. Attribute VB_Creatable = False
  146. Attribute VB_Exposed = False
  147. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  148. ' Support for text output
  149. '
  150. Public NL As String          ' Carriage return + newline
  151. Public T As String           ' tab
  152. '
  153. ' Various global variables
  154. '
  155. Public Ret As Long              ' Used as return value for aiXX function calls.
  156. Public X As Single              ' Temporary vector
  157. Public Y As Single
  158. Public Par1 As Long             ' Transfer variables
  159. Public Par2 As Long
  160.  
  161. Public PenaltyCoeff As Double   ' Penalty coefficient value
  162. Public NormType As Long         ' Type of normalization
  163. Public PenaltyType As Long      ' Type of penalty function
  164. Public InfListSize As Long      ' Size of the influence list
  165. Public InfListType As Long      ' Type of the influence list
  166. Public FileName As String
  167.  
  168. '
  169. ' The model!
  170. '
  171. Public Model As Long
  172.  
  173.  
  174. Sub ReportError(ByVal err As Long)
  175.     If err <> AIERR_NO_ERROR Then
  176.         tOut = tOut + NL + "Error[" + CStr(err) + "]: "
  177.         If err = AIERR_PENALTY_ZERO Then tOut = tOut + "Penalty parameter was set to ZERO!"
  178.         If err = AIERR_NO_IO_VARIABLES Then tOut = tOut + "Input or Output variables are not properly defined! There must be at least one input and one ouput variable."
  179.         If err = AIERR_PENALTY_TOO_SMALL Then tOut = tOut + "The penalty parameter value is too small!"
  180.         If err = AIERR_EMPTY_ROW Then tOut = tOut + "An empty row was found in the model. There must be no empty rows in the model!"
  181.         If err = AIERR_EMPTY_COLUMN Then tOut = tOut + "An empty column was found in the model. There must be no empty rows in the model!"
  182.         If err = AIERR_EQUAL_COLUMN Then tOut = tOut + "All values in one columns are the same. The normalization is not possible!"
  183.         If err = AIERR_CSV_OPEN Then tOut = tOut + "Unable to open a CSV file!"
  184.         If err = AIERR_CSV_READ Then tOut = tOut + "Unable to read from CSV file. Wrong format!"
  185.         If err = AIERR_MEMORY_ALLOCATION Then tOut = tOut + "Unable to allocate new memory!"
  186.         If err = AIERR_INVALID_POINTER Then tOut = tOut + "Specified poitner (model) is invalid!"
  187.         If err = AIERR_INVALID_INDEX Then tOut = tOut + "Specified index is invalid - out of range!"
  188.         If err = AIERR_NO_FREE_ENTRY Then tOut = tOut + "There are no free entries in the model!"
  189.     End If
  190. End Sub
  191.  
  192. Sub SetupStrings()
  193.    NL = Chr(13) + Chr(10)
  194.    T = Chr(9)
  195. End Sub
  196.  
  197. Private Function IsHole(ByVal X As Single, ByVal Y As Single) As Boolean
  198.     r = Sqr(X * X + Y * Y)
  199.     If r > 0.7 Then
  200.         IsHole = False
  201.     Else
  202.         IsHole = True
  203.     End If
  204. End Function
  205.  
  206. Private Sub ExcludeBtn_Click()
  207.     If Model = 0 Then
  208.         tOut = NL + "Load the model first!"
  209.     Else
  210.         Ret = 0
  211.         ExcludeMV.Show 1
  212.         If Ret <> 0 Then
  213.             tOut = NL + "Exclude Model Vectors:" + NL
  214.             Dim exclude As Long
  215.             If Ret = 1 Or Ret = 2 Then
  216.                 exclude = 0  ' Ret = 2 ... include
  217.                 If Ret = 1 Then exclude = 1
  218.                 If ExcludeMV.Range = True Then
  219.                     Dim first As Long
  220.                     Dim last As Long
  221.                     first = CStr(ExcludeMV.first)
  222.                     last = CStr(ExcludeMV.last)
  223.                     Par1 = aiExcludeModelVectorRange(Model, first, last, exclude)
  224.                 Else
  225.                     Dim index As Long
  226.                     index = CStr(ExcludeMV.index)
  227.                     Par1 = aiExcludeModelVector(Model, index, exclude)
  228.                 End If
  229.                 If Par1 = AIERR_NO_ERROR Then
  230.                     If ExcludeMV.Range = True Then
  231.                         tOut = tOut + "Model Vectors int the range [" + ExcludeMV.first + ","